package com.example.check_in.util;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;

public class YearMonthUtil {

    public static int getDaysForMonth(int year, int month){
        YearMonth yearMonth = YearMonth.of(year, month);
        // 获取该月的天数
        return yearMonth.lengthOfMonth();
    }

    public static LocalDateTime strToLocalDateTime(String timeStr) {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        return LocalDate.parse(timeStr, formatter).atTime(12,0,0,0);
    }

    public static void main(String[] args) {
        System.out.println(strToLocalDateTime("2023-04-01"));
    }


}
